@@ -7,16 +7,16 @@ attachRatingHandler = -> |
||
7 | 7 |
# to call summernote editor |
8 | 8 |
summer_note.summernote |
9 | 9 |
# to set options |
10 |
- height:300 |
|
10 |
+ height:300 |
|
11 | 11 |
# toolbar: [ |
12 | 12 |
# ['insert', ['picture', 'link']], // no insert buttons |
13 |
- # ["table", ["table"]], |
|
14 |
- # ["style", ["style"]], |
|
15 |
- # ["fontsize", ["fontsize"]], |
|
16 |
- # ["color", ["color"]], |
|
17 |
- # ["style", ["bold", "italic", "underline", "clear"]], |
|
18 |
- # ["para", ["ul", "ol", "paragraph"]], |
|
19 |
- # ["height", ["height"]], |
|
13 |
+ # ["table", ["table"]], |
|
14 |
+ # ["style", ["style"]], |
|
15 |
+ # ["fontsize", ["fontsize"]], |
|
16 |
+ # ["color", ["color"]], |
|
17 |
+ # ["style", ["bold", "italic", "underline", "clear"]], |
|
18 |
+ # ["para", ["ul", "ol", "paragraph"]], |
|
19 |
+ # ["height", ["height"]], |
|
20 | 20 |
# ["help", ["help"]] |
21 | 21 |
#] |
22 | 22 |
|
@@ -25,8 +25,8 @@ attachRatingHandler = -> |
||
25 | 25 |
|
26 | 26 |
# to get code for summernote |
27 | 27 |
summer_note.closest('form').submit -> |
28 |
- # alert $('#post_content').code()[0] |
|
29 |
- summer_note.val summer_note.code()[0] |
|
28 |
+ # alert $('#post_content').code() |
|
29 |
+ summer_note.val summer_note.code() |
|
30 | 30 |
true |
31 | 31 |
|
32 | 32 |
$(document).ready attachRatingHandler |
@@ -73,6 +73,6 @@ class BlogPostsController < ApplicationController |
||
73 | 73 |
|
74 | 74 |
# Never trust parameters from the scary internet, only allow the white list through. |
75 | 75 |
def blog_post_params |
76 |
- params.require(:blog_post).permit(:title, :slug, :content, :published, :author_id) |
|
76 |
+ params.require(:blog_post).permit(:title, :slug, :content, :published, :description, :author_id) |
|
77 | 77 |
end |
78 | 78 |
end |
@@ -4,6 +4,7 @@ |
||
4 | 4 |
<div class="form-inputs"> |
5 | 5 |
<%= f.input :title %> |
6 | 6 |
<%= f.input :slug %> |
7 |
+ <%= f.input :description %> |
|
7 | 8 |
<%= f.input :content, class: 'summernote', id: 'post_content' %> |
8 | 9 |
<%= f.input :published %> |
9 | 10 |
</div> |
@@ -8,7 +8,7 @@ |
||
8 | 8 |
<div class="thumbnail"> |
9 | 9 |
<img src="http://placehold.it/300x200" alt=""> |
10 | 10 |
<h3><%= link_to post.title, post_path(post) %></h3> |
11 |
- <p><%= post.content %></p> |
|
11 |
+ <p><%= post.description %></p> |
|
12 | 12 |
</div> |
13 | 13 |
</li> |
14 | 14 |
<% end %> |
@@ -21,7 +21,7 @@ |
||
21 | 21 |
<tr> |
22 | 22 |
<td><%= blog_post.title %></td> |
23 | 23 |
<td><%= blog_post.slug %></td> |
24 |
- <td><%= blog_post.content %></td> |
|
24 |
+ <td><%= blog_post.description %></td> |
|
25 | 25 |
<td><%= blog_post.published %></td> |
26 | 26 |
<td><%= blog_post.author.full_name %></td> |
27 | 27 |
<td><%= link_to 'Show', post_path(blog_post) %></td> |
@@ -1,29 +1,15 @@ |
||
1 |
-<p id="notice"><%= notice %></p> |
|
1 |
+<div class="page-header"> |
|
2 |
+ <h1><%= @blog_post.title %></h1> |
|
3 |
+ <small>by <%= @blog_post.author.full_name %>, <%= time_ago_in_words(@blog_post.created_at) %> ago</small> |
|
4 |
+</div> |
|
2 | 5 |
|
3 |
-<p> |
|
4 |
- <strong>Title:</strong> |
|
5 |
- <%= @blog_post.title %> |
|
6 |
-</p> |
|
6 |
+<%= @blog_post.content.html_safe %> |
|
7 | 7 |
|
8 |
-<p> |
|
9 |
- <strong>Slug:</strong> |
|
10 |
- <%= @blog_post.slug %> |
|
11 |
-</p> |
|
8 |
+<hr> |
|
12 | 9 |
|
13 |
-<p> |
|
14 |
- <strong>Content:</strong> |
|
15 |
- <%= @blog_post.content %> |
|
16 |
-</p> |
|
17 |
- |
|
18 |
-<p> |
|
19 |
- <strong>Published:</strong> |
|
20 |
- <%= @blog_post.published %> |
|
21 |
-</p> |
|
22 |
- |
|
23 |
-<p> |
|
24 |
- <strong>Author:</strong> |
|
25 |
- <%= @blog_post.author.full_name %> |
|
26 |
-</p> |
|
27 |
- |
|
28 |
-<%= link_to 'Edit', edit_blog_post_path(@blog_post) %> | |
|
29 |
-<%= link_to 'Back', blog_path %> |
|
10 |
+<% if user_signed_in? %> |
|
11 |
+ <%= link_to 'Edit', edit_blog_post_path(@blog_post) %> | |
|
12 |
+ <%= link_to 'Back', blog_path %> |
|
13 |
+<% else %> |
|
14 |
+ <%= link_to 'Back', blog_path %> |
|
15 |
+<% end %> |
@@ -0,0 +1,5 @@ |
||
1 |
+class AddDescriptionToBlogPost < ActiveRecord::Migration |
|
2 |
+ def change |
|
3 |
+ add_column :blog_posts, :description, :string |
|
4 |
+ end |
|
5 |
+end |
@@ -11,7 +11,7 @@ |
||
11 | 11 |
# |
12 | 12 |
# It's strongly recommended that you check this file into your version control system. |
13 | 13 |
|
14 |
-ActiveRecord::Schema.define(version: 20140916213814) do |
|
14 |
+ActiveRecord::Schema.define(version: 20140918033424) do |
|
15 | 15 |
|
16 | 16 |
# These are extensions that must be enabled in order to support this database |
17 | 17 |
enable_extension "plpgsql" |
@@ -24,6 +24,7 @@ ActiveRecord::Schema.define(version: 20140916213814) do |
||
24 | 24 |
t.integer "author_id" |
25 | 25 |
t.datetime "created_at" |
26 | 26 |
t.datetime "updated_at" |
27 |
+ t.string "description" |
|
27 | 28 |
end |
28 | 29 |
|
29 | 30 |
add_index "blog_posts", ["author_id"], name: "index_blog_posts_on_author_id", using: :btree |
@@ -3,13 +3,13 @@ |
||
3 | 3 |
A template for creating rails websites that includes the following: |
4 | 4 |
|
5 | 5 |
* User System (Devise) |
6 |
-* Twitter Bootstrap + Flatstrap |
|
6 |
+* Twitter Bootstrap + Flatstrap + Font Awesome |
|
7 | 7 |
* Basic Blog |
8 |
+* SummerNote editor |
|
8 | 9 |
|
9 | 10 |
Other features are still under development: |
10 | 11 |
|
11 | 12 |
* Admin Panel |
12 |
-* SummerNote editor |
|
13 | 13 |
* Image upload/File System |
14 | 14 |
* Translation (pt-BR, EN) |
15 | 15 |
* Email System |